<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>

<head>
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css">
    <script src="${ctx}/layui/jquery.js"></script>
</head>

<body>


<blockquote class="layui-elem-quote">你好！${user.getSysUser().getUsername()}</blockquote>


<div class="layui-row">
    <div class="layui-col-xs-offset layui-col-xs6">
        <div id="cal"></div>
    </div>
</div>


</body>
<script src="${ctx}/layui/layui.all.js"></script>
<script>

    layui.use(['form', 'element', 'laydate'], function () {
        var form = layui.form;
        var laydate = layui.laydate;
        form.on("submit(ff)", data => {
            $.ajax({
                url: "${ctx}/login/login",
                type: "post",
                dataType: "json",
                contentType: "application/json",
                data: JSON.stringify(data.field),
                success: res => {
                    if (res.code == 1) {
                        window.location.href = "${ctx}/home/index"
                    } else {
                        layer.msg(res.msg)
                    }

                },
                error: res => {
                    alert(res.msg)
                }
            })

            return false;
        })
        laydate.render({
            elem: '#cal',
            position: 'static',

            calendar: true,
            change: function (value, date) { //监听日期被切换
                lay('#testView').html(value);
            }
        });
    })
</script>

</html>
<style>
    .layui-card {
        margin: 8% 30% 0 30%;
        background-color: #f0f0f0;
    }

    .layui-form-item {
        padding-top: 5%;
    }
</style>